#ifndef MONSTER_H
#define MONSTER_H

#include <vector>
#include "GlobalVariables.h"
#include "Movables.h"
#include "Utilities.h" //for delta and contains functions
#include <allegro5\allegro5.h>
#include "Point.h"
#include "Map.h"

using namespace std;


//! This is a child class of Movables and contains the implementation for monsters
class Monster: public Movables {
public:

	Monster(Point& location); //constructor
	Monster(){}

	virtual DetectionResult move(Map& map);
	virtual DetectionResult collisionCheck(Movable_type position_type) const;
	virtual void allowMove(Direction direction);

	void updateMoveDirection(Point& digdug_location, Map& map);
	vector<Direction> getValidDirections(Point& location, Map& map);
	void updateGhostMode(Point& digdug_location);
	bool isGhost();
	bool blowUp();

	void setAutoRoute(vector <Point> route);
	void clearRoute();
	int blowUpSize();
private:

//Datamembers of the class
	bool _is_ghost;
	Point _ghost_end_position;
	int _ghost_mode_counter;
	int _blow_up_size;
	int _max_blow_up_size;
	vector<Point> _monster_route;
	vector <Direction> _direction_list; //!< Used in self routing when ther is no path directily to digdug
	
//! \brief Private member functions to be used by Monster class.

	Point nextCoordinate();
	Direction selfRoute(Point& digdug_location, Map &map);
	void moveGhost();
	
};

//!Standalone Monster Routing
//void routeMonsters(Map &map, Point &digdug_position, vector<Monster> &monsters);
bool contains(vector <Point> point_list, Point point );
int monsterLocatedcheck(const vector<Point> route, vector<Monster> & monsters);
void routeMonsters(Map &map, Point &digdug_position, vector <Monster> & monsters );
#endif